﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using RCREEE.Library;

namespace RCREEE.Web
{
    public partial class Content : System.Web.UI.Page
    {
        private string QS_ContentId = "n";

        private string SS_LangCode = "LanguageCode";
        private string VS_PageTitle = "PageTitle";

        public int ContentId
        {
            get
            {
                int contentId = 0;
                if (Request.QueryString[QS_ContentId] != null)
                    int.TryParse(Request.QueryString[QS_ContentId], out contentId);
                return contentId;
            }
        }
        public int LanguageCode
        {
            get
            {
                int langCode = 0;
                if (Session[SS_LangCode] != null)
                    int.TryParse(Session[SS_LangCode].ToString(), out langCode);
                return langCode;
            }
            set
            {
                Session[SS_LangCode] = value;
            }
        }

        public string PageTitle
        {
            get
            {
                if (ViewState[VS_PageTitle] != null)
                    return ViewState[VS_PageTitle].ToString();
                return string.Empty;
            }
            set
            {
                ViewState[VS_PageTitle] = value;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
                //LanguageCode = (int)LanguagesEnum.English;
                var content = DataManager.GetNodeContent(ContentId, LanguageCode);
                lblTitle.Text = content.Key;
                lblContent.Text = content.Value;
            //}
        }
    }
}